package map;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;

public class Weather {

    BufferedImage image;
    int maTran[][] = {{0, 0}, {256, 0}, {512, 0}, {768, 0}, {1024, 0},
    {0, 256}, {256, 256}, {512, 256}, {768, 256}, {1024, 256},
    {0, 512}, {256, 512}, {512, 512}, {768, 512}, {1024, 512},
    {0, 768}, {256, 768}, {512, 768}, {768, 768}, {1024, 768}};

    final int SUN = 0;
    final int SNOW = 1;
    final int RAIN = 2;

    public Weather(int type) {
        try {
            switch (type) {
                case SNOW:
                    image = ImageIO.read(getClass().getResourceAsStream("/map/snow.png"));
                    break;
                case RAIN:
                    image = ImageIO.read(getClass().getResourceAsStream("/map/rainNW.png"));
                    break;
                default:
                    image = null;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    void paint(Graphics g) {
        if (image == null) {
            return;
        }
        for (int i = 0; i < 15; i++) {

            g.drawImage(image, maTran[i][0] - 256, maTran[i][1] - 256, null);
            maTran[i][0] = ((++(maTran[i][0])) % 1280);
            maTran[i][1] = ((++(maTran[i][1])) % 768);

        }
    }

}
